/**
 * Delta X Firmware
 * Copyright (c) 2020 DeltaXFirmware [https://github.com/deltaxrobot/Delta-X-Firmware]
 *
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// Constants.h

#ifndef _CONSTANTS_h
#define _CONSTANTS_h

#include "config.h"
#include "enum.h"
#include "Geometry.h"

/**
 * 定义点坐标
 */
typedef struct {
    float X; // x坐标
    float Y; // y坐标
    float Z; // z坐标
} Point;

/**
 * 定义各个大臂的角度
 */
typedef struct {
    float Theta1;
    float Theta2;
    float Theta3;
} Angle;

/**
 * 常量类，下面回声明一个全局的常量对象，为DATA
 */
class Constants {
public:
    void init();

    void ResetData();

    /**
     * 以下定义一套Delta机器的参数
     * @see 参见：Delta_Firmware/Geometry.h 有详细的图文介绍
     */
    float RD_F;
    float RD_E;
    float RD_RF;
    float RD_RE;

    float RD_W;
    float RD_U;
    float RD_V;

    /**
     * 下面三个是移动的xyz坐标系的范围
     */
    float MOVING_AREA_X;
    float MOVING_AREA_Y;
    float MOVING_AREA_Z;

    /**
     * 下面是移动最大直径
     */
    float MOVING_AREA_LARGEST_DIAMETER;
    //

    /**
     * 移动速度和加速度
     */
    float Velocity;            //mm/s
    float Acceleration;        //mm/s^2

    /**
     * 回零点的速度
     */
    float MovingHomeSpeed;

    float BeginEndVelocity;

    float EntryVelocity;
    float ExitVelocity;

    bool IsMoveWithTheAbsoluteCoordinates;

    bool IsExecutedGcode;

    /** 末端执行器 */
    END_EFFECTOR End_Effector;

    float MMPerLinearSegment;
    float MMPerArcSegment;

    Point CurrentPoint;
    Point DesiredPoint;
    Point HomePosition;

    Angle CurrentAngle;

    float ZOffset;

    float ExtrustionPosition;

    int WPosition;
private:

};

/**
 * 声明外部依赖的常量对象 Data
 */
extern Constants Data;

#endif

